package d0326;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class TestHashSet {
    public static void main(String[] args) {
        Set<Student> set = new HashSet<>();
        Student stu1 = new Student("Jack",24,98);
        Student stu2 = new Student("Lucy",21,99);
        Student stu3 = new Student("Jack",24,98);
        set.add(stu1);
        set.add(stu2);
        set.add(stu3);

        /*System.out.println(set.size());
        for(Student s : set) {
            System.out.println(s);
        }*/

        Iterator<Student> iterator = set.iterator();
        while (iterator.hasNext()){
            Student student = iterator.next();
            System.out.println(student);
        }
    }
}
        /*set.add("111");
        set.add("222");
        set.add("333");
        set.add("111");
        System.out.println("是否存在111"+set.contains("111"));
        System.out.println("set是否为空"+set.isEmpty());
        System.out.println("删除111"+set.remove("111"));
        for(String str : set) {
            System.out.println(str);
        }
        System.out.println("清空set");
        set.clear();
        System.out.println("set是否为空"+set.isEmpty());*/